
class Person{
    //属性 -> 成员变量
    public String name;
    public String addr;

    //行为 -> 成员方法
    public void hobby(){
        System.out.println(name + "play and relax");
    }
    public void ability(){
        System.out.println(name + "programing and design");
    }

}
class TestDate{
    public int day;
    public int month;
    public int year;

//    public void setDate(int y,int m,int d){
//        day = d;
//        month = m;
//        year = y;
//    }

    public void setDate(int year,int month,int day){
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public void printDate(){
        System.out.println(year+"-"+month+"-"+day);
    }
}

public class Test {
    public static void main(String[] args) {
        TestDate testDate = new TestDate();
//        testDate.year = 2022;
//        testDate.month = 11;
//        testDate.day = 16;
        testDate.setDate(2022,11,16);
        testDate.printDate();
    }
    public static void main1(String[] args) {
        //实例化
        Person person = new Person();
        person.name = "李田所";
        person.addr = "下北泽";
        System.out.println(person.name);
        person.hobby();
    }
}
